package repository

import (
	"gitee.com/lvshicong/inspection-helper/internal/database"
	"gitee.com/lvshicong/inspection-helper/internal/models"
)

func GetCnafMySql(teant string) (result *models.CnafMysqlMetric) {
	db := database.GetMysqlConn("db_oil_pvg")
	var count1, count2, count3 int64

	db.Table("flightinfo").Distinct("flop").Count(&count1)
	db.Table("flight_change").Distinct("flop").Count(&count2)
	db.Table("srv_task").Distinct("flop").Count(&count3)
	return &models.CnafMysqlMetric{
		FlightInfo:  float64(count1),
		FlightChage: float64(count2),
		SrvTask:     float64(count3),
	}

}
